<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>uvgRTP: include/session.hh Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">uvgRTP
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">session.hh</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="preprocessor">#pragma once</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160; </div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="preprocessor">#include &lt;mutex&gt;</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160; </div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#include &quot;media_stream.hh&quot;</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor">#include &quot;zrtp.hh&quot;</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160; </div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="keyword">namespace </span>uvgrtp {</div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160; </div>
<div class="line"><a name="l00012"></a><span class="lineno"><a class="line" href="classuvgrtp_1_1session.html">   12</a></span>&#160;    <span class="keyword">class </span><a class="code" href="classuvgrtp_1_1session.html">session</a> {</div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;        <span class="keyword">public</span>:</div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;            <a class="code" href="classuvgrtp_1_1session.html">session</a>(std::string addr);</div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;            <a class="code" href="classuvgrtp_1_1session.html">session</a>(std::string remote_addr, std::string local_addr);</div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;            ~<a class="code" href="classuvgrtp_1_1session.html">session</a>();</div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160; </div>
<div class="line"><a name="l00050"></a><span class="lineno"><a class="line" href="classuvgrtp_1_1session.html#a71aad1226214b1b0b1ba60a46c048ab2">   50</a></span>&#160;            <a class="code" href="classuvgrtp_1_1media__stream.html">uvgrtp::media_stream</a> *<a class="code" href="classuvgrtp_1_1session.html#a71aad1226214b1b0b1ba60a46c048ab2">create_stream</a>(<span class="keywordtype">int</span> src_port, <span class="keywordtype">int</span> dst_port, rtp_format_t fmt, <span class="keywordtype">int</span> flags);</div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160; </div>
<div class="line"><a name="l00063"></a><span class="lineno"><a class="line" href="classuvgrtp_1_1session.html#a291629a3bfb910463b88d8edb3984149">   63</a></span>&#160;            rtp_error_t <a class="code" href="classuvgrtp_1_1session.html#a291629a3bfb910463b88d8edb3984149">destroy_stream</a>(<a class="code" href="classuvgrtp_1_1media__stream.html">uvgrtp::media_stream</a> *stream);</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160; </div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;            <span class="comment">/* Get unique key of the session</span></div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;<span class="comment">             * Used by context to index sessions */</span></div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;            std::string&amp; get_key();</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160; </div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;        <span class="keyword">private</span>:</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;            <span class="comment">/* Each RTP multimedia session shall have one ZRTP session from which all session are derived */</span></div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;            uvgrtp::zrtp *zrtp_;</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160; </div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;            <span class="comment">/* Each RTP multimedia session is always IP-specific */</span></div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;            std::string addr_;</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160; </div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;            <span class="comment">/* If user so wishes, the session can be bound to a certain interface */</span></div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;            std::string laddr_;</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160; </div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;            <span class="comment">/* All media streams of this session */</span></div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;            std::unordered_map&lt;uint32_t, uvgrtp::media_stream *&gt; streams_;</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160; </div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;            std::mutex session_mtx_;</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;    };</div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;};</div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160; </div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;<span class="keyword">namespace </span>uvg_rtp = uvgrtp;</div>
<div class="ttc" id="aclassuvgrtp_1_1media__stream_html"><div class="ttname"><a href="classuvgrtp_1_1media__stream.html">uvgrtp::media_stream</a></div><div class="ttdef"><b>Definition:</b> media_stream.hh:18</div></div>
<div class="ttc" id="aclassuvgrtp_1_1session_html"><div class="ttname"><a href="classuvgrtp_1_1session.html">uvgrtp::session</a></div><div class="ttdef"><b>Definition:</b> session.hh:12</div></div>
<div class="ttc" id="aclassuvgrtp_1_1session_html_a291629a3bfb910463b88d8edb3984149"><div class="ttname"><a href="classuvgrtp_1_1session.html#a291629a3bfb910463b88d8edb3984149">uvgrtp::session::destroy_stream</a></div><div class="ttdeci">rtp_error_t destroy_stream(uvgrtp::media_stream *stream)</div><div class="ttdoc">Destroy a media stream.</div></div>
<div class="ttc" id="aclassuvgrtp_1_1session_html_a71aad1226214b1b0b1ba60a46c048ab2"><div class="ttname"><a href="classuvgrtp_1_1session.html#a71aad1226214b1b0b1ba60a46c048ab2">uvgrtp::session::create_stream</a></div><div class="ttdeci">uvgrtp::media_stream * create_stream(int src_port, int dst_port, rtp_format_t fmt, int flags)</div><div class="ttdoc">Create a bidirectional media stream for an RTP session.</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
</small></address>
</body>
</html>
